package org.shopen.ai.puremvc.model.problem.cities
{
	import mx.collections.ArrayCollection;
	
	import org.shopen.ai.puremvc.model.problem.ICostFunction;
	import org.shopen.ai.puremvc.model.problem.IProblem;
	import org.shopen.ai.puremvc.model.problem.IState;
	import org.shopen.ai.puremvc.model.problem.ITest;
	import org.shopen.ai.puremvc.model.problem.ITransitionModel;
	import org.un.cava.birdeye.ravis.graphLayout.data.IGraph;
	
	public class CitiesProblem implements IProblem
	{
		private var _title : String = "Unknown City Problem";
		public function get title() : String
		{
			return _title;
		}
		public function set title(value : String) : void
		{
			_title = value;
		}
		
		private var _initialState : IState;
		public function get initialState() : IState
		{
			return _initialState;
		}
		public function set initialState(value : IState) : void
		{
			_initialState = value;
		}
		
		public function get initialActions() : ArrayCollection
		{
			var result : ArrayCollection = transitionModel.buildActions(initialState);
			return result;
		}
		
		private var _transitionModel : ITransitionModel;
		public function get transitionModel() : ITransitionModel
		{
			return _transitionModel;
		}
		public function set transitionModel(value : ITransitionModel) : void
		{
			_transitionModel = value;
		}
		
		private var _goalTest : ITest;
		public function get goalTest() : ITest
		{
			return _goalTest;
		}
		public function set goalTest(value : ITest) : void
		{
			_goalTest = value;
		}
		
		private var _costFunction : ICostFunction;
		public function get costFunction() : ICostFunction
		{
			return _costFunction;
		}
		public function set costFunction(value : ICostFunction) : void
		{
			_costFunction = value;
		}
		
		public function CitiesProblem(title : String, graph : IGraph, initialState : InState, goalState : InState)
		{
			this.title = title;
			this.initialState = initialState;
			this.transitionModel = new TransitionModel(graph);
			this.goalTest = new GoalTest(goalState);
			this.costFunction = new CostFunction(graph);
		}
	}
}